<%@page import="monster.comm.util.SpringApplicationContextFactory"%>
<%@page import="monster.flight.admin.manager.service.admin.Flight_infoService"%>
<%@page import="monster.flight.comm.util.FlightFactory"%>
<%@page import="monster.comm.util.DateUtil"%>
<%@page import="monster.flight.comm.entity.vo.FlightBay"%>
<%@page import="sun.jdbc.rowset.CachedRowSet"%>
<%@page import="monster.flight.comm.entity.vo.Flight_info"%>
<%@page import="monster.comm.database.DBManager"%>
<%@page import="monster.comm.util.SysConstant"%>
<%@page import="monster.comm.util.UserService"%>
<%@page import="monster.comm.util.Tool"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String type=Tool.getRequest("type",request);//
String flight_id = Tool.getRequest("flight_id", request);

String list="";
if(type.equals(""))type="1";
if(flight_id.equals(""))flight_id="0";
UserService user = (UserService) session.getAttribute(SysConstant.SESSION_NAME);//获得session里面的登陆信息
if(1==2){
	out.println("{\"id\":-100,\"name\":\"没有登录\"}");
	return;
}else{
	try{
		DBManager db = new DBManager();
		String sql="select b.POSITION,b.staff_name,b.staff_sn from PLAN_INFO a join STAFF_INFO b on a.staff_sn=b.staff_sn where  flight_id="+flight_id
		+" order by b.POSITION";
					
		CachedRowSet cr = db.getRowSet(sql);
		StringBuilder sb = new StringBuilder(200);
		Map<String,String> map = new HashMap<String,String>();
		map.put("1","机");
		map.put("2","放");
		map.put("3","上");
		map.put("4","学");
		int i=1;
		while(cr.next()){
			String staff_sn = Tool.getRsValue(cr,"staff_sn");
			String staff_name = Tool.getRsValue(cr,"staff_name");
			String position = Tool.getRsValue(cr,"position");
			position = map.get(position);
			sb.append("{\"staff_name\":\"").append(staff_name).append("\",")
			.append("\"position\":\"").append(position).append("\",")
			.append("\"staff_sn\":\"").append(staff_sn).append("\",")
			.append("}");
			if(i++<cr.size()){
				sb.append(",");
			}
		}
		
		 list="{\"id\":100,\"list\":["+sb.toString()+"]}";
	}catch(Exception e){
		 e.printStackTrace();
		 list="{\"id\":-200,\"name\":\"程序异常\"}";
	}
	
	out.println(list);

}
%>
